/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

/*
 * VistaIngrediente.java
 *
 * Created on 06/04/2011, 01:04:53 AM
 */

package vistas;

import java.awt.event.ActionListener;
import java.util.LinkedList;
import java.util.Vector;
import javax.swing.JButton;
import javax.swing.JTextField;

/**
 *
 * @author usuario
 */
public class VistaIngrediente extends javax.swing.JFrame {

    private controladores.ControloadorIngrediente control;
    /** Creates new form VistaIngrediente */
    public VistaIngrediente() {
        initComponents();
        control= new controladores.ControloadorIngrediente(this);
        reiniciar();
    }

    public void addListener(ActionListener escuchador){
        salir.addActionListener(escuchador);
        actualizar.addActionListener(escuchador);
        cancelar.addActionListener(escuchador);
        consultar.addActionListener(escuchador);
        registrar.addActionListener(escuchador);
    }

    public void mostrar(){
        codigo.setEditable(false);
        nuevo.setVisible(true);
        jLabel7.setVisible(true);
        nuevo.setText("0");
    }

    public JButton getBtnActualizar() {
        return actualizar;
    }

    public JButton getBtnConsultar() {
        return consultar;
    }



     public void reiniciar(){
        codigo.setText("");
        descripcion.setText("");
        stock.setText("");
        stock.setEditable(true);
        codigo.setEditable(true);
        nuevo.setVisible(false);
        jLabel7.setVisible(false);
        nuevo.setText("0");
    }

    public JButton getActualizar() {
        return actualizar;
    }

    public JButton getConsultar() {
        return consultar;
    }

    public JTextField getNuevo() {
        return nuevo;
    }



    public JButton getCancelar() {
        return cancelar;
    }

    public JButton getRegistrar() {
        return registrar;
    }

    public JButton getSalir() {
        return salir;
    }

    public JTextField getCodigo() {
        return codigo;
    }

    public JTextField getDescripcion() {
        return descripcion;
    }

    public JTextField getStock() {
        return stock;
    }

    public LinkedList<JTextField> getTextos() {
        LinkedList<JTextField> v = new LinkedList<JTextField>();
        v.add(codigo);
        v.add(nuevo);
        v.add(descripcion);
        v.add(stock);
        return v;
    }




    
    

    /** This method is called from within the constructor to
     * initialize the form.
     * WARNING: Do NOT modify this code. The content of this method is
     * always regenerated by the Form Editor.
     */
    @SuppressWarnings("unchecked")
    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
    private void initComponents() {

        jPanel1 = new javax.swing.JPanel();
        stock = new javax.swing.JTextField();
        nuevo = new javax.swing.JTextField();
        jLabel6 = new javax.swing.JLabel();
        jLabel5 = new javax.swing.JLabel();
        jLabel1 = new javax.swing.JLabel();
        descripcion = new javax.swing.JTextField();
        jLabel7 = new javax.swing.JLabel();
        codigo = new javax.swing.JTextField();
        salir = new javax.swing.JButton();
        cancelar = new javax.swing.JButton();
        actualizar = new javax.swing.JButton();
        registrar = new javax.swing.JButton();
        consultar = new javax.swing.JButton();

        setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
        setTitle("Registro de Ingredientes");
        getContentPane().setLayout(null);

        jPanel1.setBorder(new javax.swing.border.MatteBorder(null));
        jPanel1.setLayout(null);

        stock.setFont(new java.awt.Font("Arial", 0, 13));
        jPanel1.add(stock);
        stock.setBounds(140, 90, 130, 30);

        nuevo.setFont(new java.awt.Font("Arial", 0, 13));
        nuevo.setText("0");
        jPanel1.add(nuevo);
        nuevo.setBounds(140, 130, 130, 30);

        jLabel6.setFont(new java.awt.Font("Arial Black", 0, 13)); // NOI18N
        jLabel6.setText("Codigo:");
        jPanel1.add(jLabel6);
        jLabel6.setBounds(20, 10, 130, 30);

        jLabel5.setFont(new java.awt.Font("Arial Black", 0, 13)); // NOI18N
        jLabel5.setText("Disponibilidad:");
        jPanel1.add(jLabel5);
        jLabel5.setBounds(20, 90, 130, 30);

        jLabel1.setFont(new java.awt.Font("Arial Black", 0, 13)); // NOI18N
        jLabel1.setText("Descripcion:");
        jPanel1.add(jLabel1);
        jLabel1.setBounds(20, 50, 140, 32);

        descripcion.setFont(new java.awt.Font("Arial", 0, 13));
        jPanel1.add(descripcion);
        descripcion.setBounds(140, 50, 130, 32);

        jLabel7.setFont(new java.awt.Font("Arial Black", 0, 13)); // NOI18N
        jLabel7.setText("Cantidad Nueva:");
        jPanel1.add(jLabel7);
        jLabel7.setBounds(20, 130, 140, 30);
        jPanel1.add(codigo);
        codigo.setBounds(140, 10, 130, 28);

        getContentPane().add(jPanel1);
        jPanel1.setBounds(60, 20, 290, 190);

        salir.setFont(new java.awt.Font("Arial Black", 0, 13)); // NOI18N
        salir.setText("Salir");
        getContentPane().add(salir);
        salir.setBounds(370, 180, 120, 30);

        cancelar.setFont(new java.awt.Font("Arial Black", 0, 13)); // NOI18N
        cancelar.setText("Cancelar");
        cancelar.setPreferredSize(new java.awt.Dimension(80, 30));
        getContentPane().add(cancelar);
        cancelar.setBounds(370, 140, 120, 30);

        actualizar.setFont(new java.awt.Font("Arial Black", 0, 13)); // NOI18N
        actualizar.setText("Actualizar");
        actualizar.setPreferredSize(new java.awt.Dimension(80, 30));
        getContentPane().add(actualizar);
        actualizar.setBounds(370, 100, 120, 30);

        registrar.setFont(new java.awt.Font("Arial Black", 0, 13)); // NOI18N
        registrar.setText("Registrar");
        registrar.setPreferredSize(new java.awt.Dimension(80, 30));
        getContentPane().add(registrar);
        registrar.setBounds(370, 20, 120, 30);

        consultar.setFont(new java.awt.Font("Arial Black", 0, 13)); // NOI18N
        consultar.setText("Consultar");
        consultar.setPreferredSize(new java.awt.Dimension(80, 30));
        getContentPane().add(consultar);
        consultar.setBounds(370, 60, 120, 30);

        java.awt.Dimension screenSize = java.awt.Toolkit.getDefaultToolkit().getScreenSize();
        setBounds((screenSize.width-558)/2, (screenSize.height-261)/2, 558, 261);
    }// </editor-fold>//GEN-END:initComponents


    /**
    * @param args the command line arguments
    */
    public static void main(String args[]) {
        java.awt.EventQueue.invokeLater(new Runnable() {
            public void run() {
                new VistaIngrediente().setVisible(true);
            }
        });
    }

    // Variables declaration - do not modify//GEN-BEGIN:variables
    private javax.swing.JButton actualizar;
    private javax.swing.JButton cancelar;
    private javax.swing.JTextField codigo;
    private javax.swing.JButton consultar;
    private javax.swing.JTextField descripcion;
    private javax.swing.JLabel jLabel1;
    private javax.swing.JLabel jLabel5;
    private javax.swing.JLabel jLabel6;
    private javax.swing.JLabel jLabel7;
    private javax.swing.JPanel jPanel1;
    private javax.swing.JTextField nuevo;
    private javax.swing.JButton registrar;
    private javax.swing.JButton salir;
    private javax.swing.JTextField stock;
    // End of variables declaration//GEN-END:variables

}
